<?php 
require_once("admin_header.php");

$did=false;
if(isset($_POST['do']))
{
	//echo $_POST['user_id'];
	require_once("../include/check_post_key.php");
	//echo $_POST['passwd'];
	require_once("../include/my_func.inc.php");
	
		$user_id=$_POST['user_id'];
    $passwd =$_POST['passwd'];
    if (get_magic_quotes_gpc ()) 
    {
			$user_id = stripslashes ( $user_id);
			$passwd = stripslashes ( $passwd);
		}
	$user_id=mysql_real_escape_string($user_id);
	$passwd=pwGen($passwd);
	$sql="update `cr_user` set `user_password`='$passwd' where `user_id`='$user_id'  and user_id not in( select user_id from cr_privilege where rightstr='cr_admin') ";
	mysql_query($sql);
	$did=true;
}

?>

	

      <div class="fr wid59">
        <?php 
	        if($isdo)
				echo "更新时间： ".date('Y-m-d h:i:s');
		?>
        <h2 class="h2">修改密码</h2>
        <div class="middle">
	<form method='post'>
		<?php 
		if($did)
		{
			if (mysql_affected_rows()==1) echo "<font color=green>密码修改成功!</font>";
		  else echo "<font color=red>没有这个用户或该用户为管理员!</font>";
		}
  ?>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td height="40" align="left"><p align="left"><strong>用户名:</strong>
							<input name="user_id" class="inpus1" size="71" />
						</td>
					</tr>
					<tr>
						<td height="40" align="left"><p align="left"><strong>新密码:</strong>
							<input name="passwd" class="inpus1" size="71"/>
						</td>
				  </tr>
				  <tr>
				    <td height="40" align="left">
				    <input type="image" name="submit" id="submit" src="<?php echo "../template/$BM_TEMPLATE/images/"; ?>02_03-16.jpg"/>
				    <input type="image" name="reset" id="reset" src="<?php echo "../template/$BM_TEMPLATE/images/"; ?>06_03.jpg" onclick="this.form.reset(); return false;" /></td>
					</tr>
				  <tr>
				    <td height="40" align="left">&nbsp;</td>
				  </tr>
				  <tr>
				    <td height="40" align="left">&nbsp;</td>
				  </tr>
				  <tr>
				    <td height="40" align="left">&nbsp;</td>
				  </tr>
				</table>
	<input type='hidden' name='do' value='do'>
	<?php require_once("../include/set_post_key.php");?>
</form>

        </div>
  </div>
     
<?php 
require_once('menu.php');
require_once('admin_footer.php');
?>
